version: "3.7"

services:
  postgres:
    container_name: postgres_container
    image: postgres:latest
    environment:
      POSTGRES_DB: "blog_db"
      POSTGRES_USER: "user"
      POSTGRES_PASSWORD: "useruser"
      PGDATA: "/var/lib/postgresql/data/pgdata"
    volumes:
      - .:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    networks:
      - proxy


  djangogirls:
    container_name: djangogirls
    build:
      context: .
      dockerfile: Dockerfile
    environment:
      VIRTUAL_HOST: django.localhost
      VIRTUAL_PORT: 8000
    ports:
      - "80:8000"
    networks:
      - proxy
    volumes:
      - ./db:/app/db

networks:
  proxy:
    driver: bridge
    name: proxy
